<?php
function _link()
{
    //global $_link;
    $_link = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
    if (mysqli_connect_errno()) {
        printf('连接 MySQL 失败:' . mysqli_connect_error());
        exit();
    }
    return $_link;
}

function _query($_link,$_sql)
{
    if (!$_result = mysqli_query($_link,$_sql)) {
        printf('SQL语句执行出错'.$_sql . mysqli_sqlstate($_link));
    }
    return $_result;
}

function _fetch_assoc($_link,$_sql){
return mysqli_fetch_assoc(_query($_link, $_sql));
}

function _is_repeat($_link,$_sql,$info){
    if(_fetch_assoc($_link,$_sql)){
        _alert_back($info);
    }
}
?>